// JavaScript Document

 var folder=false;
 var connection=false;

 var ajax=null;
	 try
     {		 // Firefox, Opera 8.0+, Safari
	       		ajax=new XMLHttpRequest();
     }
	catch (e)
    {
      	   // Internet Explorer
           try {  ajax=new ActiveXObject("Msxml2.XMLHTTP");   }
           catch (e) { ajax=new ActiveXObject("Microsoft.XMLHTTP"); }
      }
	  

function check_connection() {
		
	ajax.abort();
	var url = "files/install.php";
	params="action=step_one&server_name=" + document.install.server_name.value+ 
			"&user_name=" + document.install.user_name.value+
			"&user_password=" + document.install.user_password.value+
			"&database_name=" + document.install.database_name.value+
			"&blog_name=" + document.install.blog_name.value+
			"&blog_title=" + document.install.blog_title.value+
			"&blog_owner=" + document.install.blog_owner.value+
			"&blog_url=" + document.install.blog_url.value+
			"&admin_name=" + document.install.admin_name.value+
			"&admin_email=" + document.install.admin_email.value+
			"&admin_password=" + document.install.admin_password.value;
	
   // alert(params);
    ajax.open("POST", url, true);
	  //Send the proper header information along with the request
      ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      ajax.setRequestHeader("Content-length", params.length);
      ajax.setRequestHeader("Connection", "close");
	
      ajax.onreadystatechange=function() {
       if(ajax.readyState == 0)  { document.getElementById('info1').innerHTML = "Checking...."; } 
       if(ajax.readyState == 1)  { document.getElementById('info1').innerHTML = "Checking...."; } 
	   if(ajax.readyState == 2)  { document.getElementById('info1').innerHTML = "Checking...."; } 
	   if(ajax.readyState == 3)  { document.getElementById('info1').innerHTML = "Checking...."; } 
       if(ajax.readyState == 4)  { 
	   document.getElementById('info1').innerHTML =ajax.responseText
	   
			                              }
                                       
									     }
      ajax.send(params);
    }
	
	function check_folder() {
		
	  ajax.abort();
	  params="files/install.php?action=check_folder"; 
      ajax.open("GET", params , true);
      ajax.onreadystatechange=function() {
	   if(ajax.readyState == 0)   { document.getElementById('leftmenu').innerHTML = "checking...";        } 
       if(ajax.readyState == 1)   { document.getElementById('leftmenu').innerHTML = "checking...";               } 
	   if(ajax.readyState == 2)   { document.getElementById('leftmenu').innerHTML = "checking...";           	   } 
	   if(ajax.readyState == 3)  { document.getElementById('leftmenu').innerHTML = "checking...";         	   } 
       if(ajax.readyState == 4) 
	   {
		  document.getElementById('info2').innerHTML = ajax.responseText;
   		
		}
                                          }
      ajax.send(null);
    }
	
	function manual_install() {
		
	 ajax.abort();
	var url = "files/install.php";
	params="action=manual_install&server_name=" + document.install.server_name.value + 
					"&user_name=" + document.install.user_name.value+
					"&user_password=" + document.install.user_password.value+
					"&database_name=" + document.install.database_name.value; 
	
   // alert(params);
    ajax.open("POST", url, true);
	  //Send the proper header information along with the request
      ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      ajax.setRequestHeader("Content-length", params.length);
      ajax.setRequestHeader("Connection", "close");
	  
	  
     
      ajax.onreadystatechange=function() {
	   if(ajax.readyState == 0)   { document.getElementById('info2').innerHTML = "checking...";        } 
       if(ajax.readyState == 1)   { document.getElementById('info2').innerHTML = "checking...";               } 
	   if(ajax.readyState == 2)   { document.getElementById('info2').innerHTML = "checking...";           	   } 
	   if(ajax.readyState == 3)  { document.getElementById('info2').innerHTML = "checking...";         	   } 
       if(ajax.readyState == 4) 
	   {
		  document.getElementById('info2').innerHTML = ajax.responseText;
   		
		}
                                          }
      ajax.send(params);
    }